#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:4_count_characters.py
# author:张世航
# datetime:2024/10/31 19:23
# software: PyCharm
"""
this is function  description 
"""
# import module your need

# 4  写函数，统计字符串中有几个字母，几个数字，几个空格，几个其他字符，并返回结果;

def count_characters(s):
    letters = sum(c.isalpha() for c in s)
    digits = sum(c.isdigit() for c in s)
    spaces = sum(c.isspace() for c in s)
    others = len(s) - (letters + digits + spaces)
    return letters, digits, spaces, others

# 用户输入
user_string = input("请输入一个字符串：")
result = count_characters(user_string)
print("字母:", result[0], "数字:", result[1], "空格:", result[2], "其他字符:", result[3])